import request from "@/utils/request";

export function login(data) {
  return request({
    // url: '/vue-admin-template/user/login',
    url: "/rest/auth",
    method: "post",
    data,
  });
}

export function getInfo(token) {
  return request({
    url: "/vue-admin-template/user/info",
    method: "get",
    params: { token },
  });
}

export function logout() {
  return request({
    // url: '/rest/refresh',
    // method: 'get'
    url: "/vue-admin-template/user/logout",
    method: "post",
  });
}

// 获取全部样地数据
export function getData() {
  return request({
    url: "/biodiversity/getSampleInfo",
    method: "get",
  });
}

// 获取全部样地数据内大--------------
export function getNdData(url) {
  return request({
    url: `/nd/yd/getPlotsByByCondition?${url}`,
    method: "get",
  });
}

// 删除样地信息
export function delData(id) {
  return request({
    url: `/biodiversity/delBiodiversity/${id}`,
    method: "get",
  });
}

// 删除样地信息内大-------------
export function deletePlotsByid(id) {
  return request({
    url: `/nd/yd/deletePlotsByid?id=${id}`,
    method: "get",
  });
}

// 新增数据
export function addData(data) {
  return request({
    url: "/biodiversity/saveBiodiversity",
    method: "post",
    data,
  });
}

// 新增数据内大批量--------
export function batAddPlot(data) {
  return request({
    url: "/nd/yd/batAddPlot",
    method: "post",
    data,
  });
}

// 新增数据内大------------
export function addPlot(data) {
  return request({
    url: "/nd/yd/addPlot",
    method: "post",
    data,
  });
}

// 修改数据
export function xiugaiData(data) {
  return request({
    url: "/biodiversity/updateBiodiversity",
    method: "post",
    data,
  });
}

// 修改数据内大------------
export function editPlot(data) {
  return request({
    url: "/nd/yd/editPlot",
    method: "post",
    data,
  });
}

// 根据id查数据
export function getSampleInfoById(id) {
  return request({
    url: `biodiversity/getSampleInfoBySampleId/${id}`,
    method: "get",
  });
}

// 根据id查数据内大------------------
export function getPlotsInfoByid(id) {
  return request({
    url: `/nd/yd/getPlotsInfoByid?id=${id}`,
    method: "get",
  });
}

// 通过样地编号查询图片
export function fetchImagesBySampleId(sampleId) {
  return request({
    // /biodiversity/getHashFileBySampleId/{sampleId}
    url: `/biodiversity/getHashFileBySampleId/${sampleId}`,
    method: "get",
  });
}
// 通过物种名查询拉丁名
export function queryWzm(name) {
  return request({
    // /biodiversity/getHashFileBySampleId/{sampleId}
    url: `/biodiversity/wzmAndLdm/${name}`,
    method: "get",
  });
}
// 批量录入数据
export function luruData(data) {
  return request({
    url: "biodiversity/saveBiodiversityBatch",
    method: "post",
    data,
  });
}

// 物种库
// 获取物种库数据
export function getWzkData() {
  return request({
    url: "nd/zw/getWzByCondition",
    method: "get",
  });
}
// 获取属名称
export function getSmcData() {
  return request({
    url: "/allcode/getallcode",
    method: "get",
  });
}

// 新增物种库数据

export function addWzkData(data) {
  return request({
    url: "/WztInfo/addwztinfo",
    method: "post",
    data,
  });
}

// 修改物种库数据
export function updateWzkData(data) {
  return request({
    url: "/WztInfo/editwztinfo",
    method: "post",
    data,
  });
}

// 删除物种库数据
export function delWzkData(id) {
  return request({
    url: `/nd/zw/deleteSpecies?id=${id}`,
    method: "get",
  });
}

// 删除物种库数据
export function delAnimalData(id) {
  return request({
    url: `/nd/dw/deleteSpecies?id=${id}`,
    method: "get",
  });
}
export function updateImageData(wzmc) {
  return request({
    url: "/rest/uploadpic",
    method: "post",
    ydbh: wzmc,
  });
}

// 监测物种管理
// 动物调查
export function getAnimalData() {
  return request({
    url: "/surveySample",
    method: "get",
  });
}

// 新增植物
export function addPantData(data) {
  return request({
    url: "/surveySample/saveSurveySample",
    method: "post",
    data,
  });
}

// 修改植物
export function updatePlantData(data) {
  return request({
    url: "/surveySample/updateSurveySample",
    method: "post",
    data,
  });
}
// 删除植物
export function delPlantSurveyPointData(id) {
  return request({
    url: `nd/plantsurvey/deleteSurveyPoint?id=${ids}`,
    method: "get",
  });
}

// 物种分布统计
export function getDistributedSpecies() {
  return request({
    url: "/distributed/getDistributedSpecies",
    method: "get",
  });
}
// http://192.168.1.103:8200/distributed/getDistributedSpecies

// 用户管理
// 用户列表
export function userList() {
  return request({
    url: "/user/userlist",
    method: "get",
  });
}

// 添加用户
export function addUserinfo(data) {
  return request({
    url: "/user/adduserinfo",
    method: "post",
    data,
  });
}
// 修改用户
export function editUserinfo(data) {
  return request({
    url: "/user/edituserinfo",
    method: "post",
    data,
  });
}
// 删除用户
export function deleteUser(id) {
  return request({
    url: `/user/deleteuser/${id}`,
    method: "get",
  });
}
// 批量删除用户
export function batchDeleteUser(data) {
  return request({
    url: `/user/batchdeleteuser`,
    method: "post",
    data,
  });
}
// 重置密码
export function resetpassword(data) {
  return request({
    url: `/user/resetpassword`,
    method: "post",
    data,
  });
}
export function updatePwd(data) {
  console.log("666", data);
  return request({
    url: `/user/updatePwd`,
    method: "post",
    data,
  });
}

// 鱼类批量录入数据
export function addBatchFish(data) {
  return request({
    url: "/fish/addBatchFish",
    method: "post",
    data,
  });
}

// 查询动物调查数据内大---------------------
export function getAnimalSurveyPointsByCondition(url) {
  return request({
    url: `/nd/animalsurvey/getAnimalSurveyPointsByCondition?${url}`,
    method: "get",
  });
}

// 新增动物调查样点数据内大-----------------
export function addSurveyPoint(data) {
  return request({
    url: "/nd/animalsurvey/addSurveyPoint",
    method: "post",
    data,
  });
}

// 修改动物调查样点数据内大-----------------
export function editSurveyPoint(data) {
  return request({
    url: "/nd/animalsurvey/editSurveyPoint",
    method: "post",
    data,
  });
}

// 批量导入动物调查样点数据内大-----------------
export function batAddSurveyPoint(data) {
  return request({
    url: "/nd/animalsurvey/batAddSurveyPoint",
    method: "post",
    data,
  });
}

// 删除动物调查样点数据内大-----------------
export function deleteSurveyPoint(id) {
  return request({
    url: `/nd/animalsurvey/deleteSurveyPoint?id=${id}`,
    method: "get",
  });
}

// 查询物种分布数据内大---------------------
export function getDistributionDataByCondition(url) {
  return request({
    url: `/nd/distributionData/getDistributionDataByCondition?${url}`,
    method: "get",
  });
}

// 新增物种分布数据内大-----------------
export function addDistributionData(data) {
  return request({
    url: "/nd/distributionData/addDistributionData",
    method: "post",
    data,
  });
}

// 修改物种分布数据内大-----------------
export function editDistributionData(data) {
  return request({
    url: "/nd/distributionData/editDistributionData",
    method: "post",
    data,
  });
}

// 删除物种分布数据内大-----------------
export function deleteDistributionData(id) {
  return request({
    url: `/nd/distributionData/deleteDistributionData?id=${id}`,
    method: "get",
  });
}

// 批量导入物种分布数据内大-----------------
export function batAddDistributionData(data) {
  return request({
    url: "/nd/distributionData/batAddDistributionData",
    method: "post",
    data,
  });
}
